AnsweredAssumed Answered

Sugar 7.8 Oauth_token handling via URL

Question asked by Offshore Evolution on Apr 24, 2017
Latest reply on Apr 27, 2017 by Matt Marum

Hello,

 

I am using iFrame rest v10 api.

 

abc.hbs

<iframe frameborder="0" width="100%" height="{{frameHeight}}" src="{{url}}"></iframe>

 

abc.js

({
    /**
     * Copyright 2015 SugarCRM Inc.  Licensed by SugarCRM under the Apache 2.0 license.
     */

    plugins: ['Dashlet'],

    /**
     * Record ID that is in context
     */

    record: undefined,

    /**
     * Module used
     */

    moduleName: undefined,

    /**
     * Base URL for iFrame (retrieved via config)
     */

    url: undefined,

    /**
     * Height for iFrame element
     */

    frameHeight: undefined,

    /**
     * Overriding initDashlet to setup values needed to render our contextual dashlet
     */

    initDashlet: function(view) {
        var ctx = this.context;
        var oauth_token = app.api.getOAuthToken();
        var model = ctx.get("model");
        if (!_.isEmpty(model)) {
            this.record = model.get("id");
        }
        this.moduleName = ctx.get("module");
        //this.url = this.settings.get("url");
        this.url = "rest/v10/Leads/fieldlist?OAuth-Token="+ oauth_token+"&record="+this.record+"&moduleName="+this.moduleName;
        this.frameHeight = this.settings.get("frameHeight");
    }

});

 

It is working well Sugar 7.*.

 

But I was try, it gave me error

 

{"error":"need_login","error_message":"No valid authentication for user."}

http://<Sugar URL>/rest/v10/Leads/fieldlist?OAuth-Token=b1fc7ff0-b1f6-4929-873a-214718d5da53&record=fc4cf7e6-2970-11e7-95bf-001e8cf557eb&moduleName=Leads

 

OAuth-Token it is not working with iframe url.

 

I am using below code

BuildingBlocks/packages/ContextualIFrameDashlet at master · sugarcrm/BuildingBlocks · GitHub 

 

 

Ramana Raju Santhana Francesca Shiekh @Matt Marum 

Outcomes