Instagram returning “Matching code was not found or was already used” when using OAuth

前端 未结 8 1172
名媛妹妹
名媛妹妹 2021-01-30 07:00

I am trying to use the Instagram OAuth using the developer documentation at

https://www.instagram.com/developer/authentication/.

Step 1 and 2 a

相关标签:
8条回答
  • 2021-01-30 07:30

    We are also experiencing the same issue from yesterday, looks like clearing browser (or new incognito window) do the trick. Although, the mobile app where we are authenticating through mobile browser, working fine.

    0 讨论(0)
  • 2021-01-30 07:36

    I solved this by creating a service on the backend/server side that authorised the user.

    My backend API is a ruby on rails app. Here is a code snippet to understand.

      def token
        @response = Instagram.get_access_token(params[:code], redirect_uri: mobile_token_url)
        instagram_user = InstagramUserCreator.new(user_params)
        if instagram_user.find_or_create
          redirect_to "taddarmobileapp://?token=#{instagram_user.user.token}"
        else
          redirect_to 'taddarmobileapp://'
        end
      end
    

    I just store the token on the phone and use it to authorise the user to my backend API.

    0 讨论(0)
提交回复
热议问题