https://yourdomain.com/auth-redirect
, or http://localhost:4000/auth-redirect
for local development.yourdomain.com
or localhost:4000
for local development.configure
method every time your page loads up.sessionType
should be set to refresh_token
endpoint
must be a custom domain endpointsessionType
should be set to cookie
prompt
to login
if you want the user always reach the login page and login again.redirectURI
with a code
parameter in the URL query. In the redirectURI
of your application, make a finish authorization call to handle the authentication result. This will attempt to exchange the code
for the access token and user info.code
query parameters.sessionState
reflects the user logged in state in the SDK local state. That means even thesessionState
is AUTHENTICATED
, the session may be invalid if it is revoked remotely. After initializing the Authgear SDK, call fetchUserInfo
to update the sessionState
as soon as it is proper to do so.logout
API will revoke the user app session only. The promise will be resolved after logout and no redirection will occur.redirectURI
to which user will be redirected after logout.fetch
function for you to call your application server. This fetch
function will include the Authorization header in your application request, and handle refresh access token automatically. The authgear.fetch
implements fetch.authgear.accessToken
. Call refreshAccessTokenIfNeeded
every time before using the access token, the function will check and make the network call only if the access token has expired. Include the access token into the Authorization header of the application request.*.yourdomain.com
to your application server will include the session cookie automatically. You can skip this section and see the next step: Backend Integration​