<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D51Y00008cghDiSAIOkta Classic EngineOkta Integration NetworkAnswered2021-03-29T16:09:31.000Z2020-06-01T14:20:26.000Z2021-03-29T16:09:31.000Z

MatthieuB.50680 (Customer) asked a question.

How to configure Okta to work with Nuxtjs Auth Module?

Hi there,

 

I'm struggling on configuring my Okta App credentials with my NuxtJS app.

 

I read this article from Andy March ( https://developer.okta.com/blog/2019/04/26/tutorial-build-universal-apps-with-nuxt ) but the Auth module has been updated since.

 

The documentation can be found here : https://auth.nuxtjs.org/

 

The module is alrealdy smoothly integrated with Autho but not Okta, for that we have to configure manually using Oauth2 schema.

 

So I followed the steps and define my nuxt.config.js like this for auth section (Flow with authorisation code) :

 

  auth: {

    redirect: {

      login: 'https://dev-777111.okta.com',

      logout: '/',

      callback: '/auth/callback',

      home: '/'

    },

    strategies: {

      social: {

        _scheme: 'oauth2',

        authorization_endpoint:  'https://dev-777111.okta.com/oauth2/default/v1/',

        userinfo_endpoint: https://dev-777111.okta.com/oauth2/default/v1/userinfo',

        scope: ['openid', 'profile', 'email'],

        access_type: 'offline',

        access_token_endpoint: https://dev-777111.okta.com/oauth2/default/v1/token' ,

        response_type: 'code',

        token_type: 'Bearer',

        client_id: 'Put my CLIENT ID HERE',

        token_key: 'access_token',

      }

    }

  },

 

Regarding the configuration of my app, it is like this:

 

/help/servlet/rtaImage?refid=0EM1Y0000012VQm

 

My app redirected me on okta login page when want to access a protected route but I never comeback to my front app after.

 

Do you know how I can configure it to have it working in a clean way?

 

Thanks a lot.

 

 

 

 

 

 

 

 

 


  • User1580983851170723709 (Vendor Management)

    Hi Matthieu,

     

    This is Dragos from Okta Support, based on the description provided, it might need some more troubleshooting on this. For that please send an email at Okta Developer Support (developers@okta.com) and one of our engineers will assist you on this matter.

  • AdamG.86238 (Customer)

    Hi Dragos,

     

    similar thing here I get redirected to Okta admin panel,

    not back to the app page... Any help?

     

    thx

    • Hi Adam,

      did you get any help on this. I am also facing same issue. If you get any help please help me

  • andy.march1.5408610786538599E12 (Cloud Enterprise Architecture)

    Hi,

     

    Just came across this while preparing an update on that post. I'm updating that guide for nuxt/auth at the moment but your config should look like the below:

     

    auth:{

    strategies:{

    okta:{

    scheme: 'oauth2',

    endpoints: {

    authorization: process.env.OAUTH_ISSUER+"/v1/authorize",

    token: process.env.OAUTH_ISSUER+"/v1/token",

    userInfo: process.env.OAUTH_ISSUER+"/v1/userinfo",

    logout: process.env.OAUTH_ISSUER+"/v1/logout"

    },

    token: {

    property: 'access_token',

    type: 'Bearer',

    maxAge: 1800

    },

    responseType: 'code',

    grantType: 'authorization_code',

    clientId: process.env.CLIENT_ID,

    scope: ['openid', 'profile', 'email'],

    codeChallengeMethod: 'S256',

    }

    },

    redirect: {

    login: '/login',

    callback: '/auth',

    home: '/'

    },

    },

     

    This does require the app to be configured as a SPA with PKCE in Okta rather than a standard web client with the authorization code grant.

    Expand Post
This question is closed.
Loading
How to configure Okta to work with Nuxtjs Auth Module?