With Magic Links customers can seamlessly sign into your customer portal from your app or website.
Magic Links are a secure passwordless authentication mechanism that lets you securely generate URLs to sign customers into your customer portal. This is perfect for redirecting users already authenticated within your app or service into your customer portal without the need for them to sign in once more.
When you sign your customer into the customer portal you can jump your customer into a sepcific page by adding a ?redirect_to parameter to the magic link URL. If you do not specify this optional parameter then the user will be redirected to the My Account page by default.
For example, to redirect your customer to the add payment method screen the resulting sign in URL would look like this:
https://{yourcompany}.invoiced.com/login/{generated_token}?redirect_to=add_payment_method
Page | Page ID |
My Account | my_account |
Credit Notes List | credit_notes |
Invoices List | invoices |
Estimates List | estimates |
Payments List | payments |
Balance Forward Statement (Current Month) | balance_forward_statement |
Open Item Statement | open_item_statement |
Pay Balance | pay |
Add Payment Method | add_payment_method |
Update Billing Information | update_billing_info |
If you are using a language not supported with an official Invoiced client library then you can still generate Magic Links. The steps to generate a JWT token will vary by language, however, there are many open source libraries that make it a simple process.
Any JWT tokens you generate should be signed using the HS256 algorithm with your Magic Link key. The token should have the following parameters for the header:
And the following parameters for the payload:
This will generate a token similar to this:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiaXNzIjoiUnVieSBCYWNrZW5kIiwiZXhwIjoxNDU1NTY0OTQ4fQ.LXu-zcMTF8ikMSRrSVYnP0szyRZuqQOAorHAsDrfwPs
We recommend taking a look at jwt.io to verify that tokens you generate are valid and to find client libraries in your language.
Here is an example showing how to generate a Magic Link in Ruby with the jwt gem (as opposed to using the invoiced-ruby library):